package com.endoc.designpattern.faced;

import com.endoc.designpattern.docorator.CheckBagDecorator;
import com.endoc.designpattern.docorator.ReinforceBagDecorator;
import com.endoc.designpattern.docorator.SpeedBagDecorator;
import com.endoc.designpattern.entity.Bag;
import com.endoc.designpattern.factory.abstractFactory.AppleFactory;

/**
 * 包装服务
 */
public class PackService {

    /**
     * 打包功能
     */
    public void doPack(){
        Bag bag = new AppleFactory().getBag();
        CheckBagDecorator checkBagDecorator = new CheckBagDecorator(bag);//防伪装饰
        SpeedBagDecorator speedBagDecorator = new SpeedBagDecorator(checkBagDecorator);//发送装饰
        ReinforceBagDecorator reinforceBagDecorator = new ReinforceBagDecorator(speedBagDecorator);//加固装饰
        reinforceBagDecorator.pack();
    }

}
